# ------------------------------------- #
# Replication code for:
#
# Pomeroy, Caleb "The Damocles Delusion: The Sense of Power Inflates Threat  
# Perception in World Politics," International Organization.
#
# This script reproduces the nuclear proliferation experiment results from the US.
# ------------------------------------- #


# --- set your working directory --- #
setwd("~/Downloads/damocles_delusion_replication/")

# --- libraries --- #
library(ggplot2)
library(plyr)
library(texreg)
library(psych)
library(mediation)
set.seed(1912)

# --- load data --- #
prolific_df <- readRDS("data/us_nuclear_proliferation_data.rds")
dim(prolific_df) # the US nuclear proliferation experiment consists of N = 1434 US-based respondents recruited from Prolific
#prolific_df$rei_intuition1 # seven-point (dis)agreement with "I trust my initial feelings about people" (higher = more intuitive)
#prolific_df$rei_intuition2 # seven-point (dis)agreement with "I believe in trusting my hunches" (higher = more intuitive)
#prolific_df$rei_intuition3 # seven-point (dis)agreement with "I can usually feel when a person is right or wrong even if I can't explain how I know" (higher = more intuitive)
#prolific_df$rei_deliberation1 # seven-point (dis)agreement with "I don't like to do a lot of thinking" (already reverse-coded, so higher = more deliberative)
#prolific_df$rei_deliberation2 # seven-point (dis)agreement with "I prefer complex to simple problems" (higher = more deliberative)
#prolific_df$rei_deliberation3 # seven-point (dis)agreement with "I try to avoid situations that require thinking in depth about something" (already reverse-coded, so higher = more deliberative)
#prolific_df$power_get_wants # seven-point (dis)agreement with "Your country can get Country B to do what your country wants" (higher = greater sense of power)
#prolific_df$power_control_influence  # seven-point (dis)agreement with "Your country has a great deal of control and influence over Country B" (higher = greater sense of power)
#prolific_df$time_pressure # seven-point (dis)agreement with "This situation should be addressed urgently, rather than in the future" (higher = more urgent)
#prolific_df$risk_acceptance # seven-point (dis)agreement with "It would be better to take risky military action now, rather than face the possible future losses from an attack by Country B" (higher = more risk acceptant)
#prolific_df$threat_confidence # ten-point assessment of "How confident are you that your threat assessment of Country B is correct?" (higher = more confident)
#prolific_df$power_trt # subjects' low power versus symmetric power versus high power condition assignment
#prolific_df$aggressive_intentions # seven-point (dis)agreement with "If Country B is developing nuclear weapons, Country B probably has aggressive intentions towards your country" (higher = more aggressive intentions)
#prolific_df$nuclear_dominos # seven-point (dis)agreement with "If Country B develops nuclear weapons, nearby countries will soon develop nuclear weapons in response" (higher = stronger domino beliefs)
#prolific_df$age # age on an eight point scale, where 1 = 18-24, 2 = 25-34, 3 = 35-44, 4 = 45-54, 5 = 55-64, 6 = 65-74, 7 = 75-84, 8 = 85 or older
prolific_df$gender <- factor(prolific_df$gender, levels = c("non_male", "male")) # self-reported male (versus female or self-describe)
#prolific_df$ethnicity # self-reported white (or non-white) respondent
#prolific_df$ideology # self-reported political ideology (higher = more conservative)
prolific_df$education <- factor(prolific_df$education, levels = c("bachelors", "less_bachelors")) # whether the respondent has completed at least a four-year college degree ("bachelors")  or not ("less_bachelors")

# --- set factor levels for treatment
prolific_df$objective_power_trt <- ifelse(prolific_df$power_trt == "objective_power", "power",
                                          ifelse(prolific_df$power_trt == "objective_symmetry", "symmetry",
                                                 ifelse(prolific_df$power_trt == "objective_weak", "weak", NA)))
prolific_df$objective_power_trt <- factor(prolific_df$objective_power_trt , levels = c("weak", "symmetry", "power"))

# --- reduce various scales of interest to unidimensional factor scores
rei_intuition_bind <- cbind(prolific_df$rei_intuition1,
                            prolific_df$rei_intuition2,
                            prolific_df$rei_intuition3)
psych::fa.parallel(rei_intuition_bind)
rei_intuition_fit <- psych::fa(rei_intuition_bind,nfactors=1, rotate="varimax",scores=TRUE, fm="pa")
prolific_df$rei_intuition_factor <- rei_intuition_fit$scores[,1]

rei_deliberation_bind <- cbind(prolific_df$rei_deliberation1,
                               prolific_df$rei_deliberation2,
                               prolific_df$rei_deliberation3)
psych::fa.parallel(rei_deliberation_bind)
rei_deliberation_fit <- psych::fa(rei_deliberation_bind,nfactors=1, rotate="varimax",scores=TRUE, fm="pa")
prolific_df$rei_deliberation_factor <- rei_deliberation_fit$scores[,1]

sense_power_bind <- cbind(prolific_df$power_control_influence,prolific_df$power_get_wants)
psych::fa.parallel(sense_power_bind)
sense_power_fit <- psych::fa(sense_power_bind,nfactors=1, rotate="varimax",scores=TRUE, fm="pa")
prolific_df$sense_power_factor <- sense_power_fit$scores[,1]

intuition_bind <- cbind(prolific_df$time_pressure,
                        prolific_df$risk_acceptance,
                        prolific_df$threat_confidence)
psych::fa.parallel(intuition_bind)
intuition_fit <- psych::fa(intuition_bind,nfactors=1, rotate="varimax",scores=TRUE, fm="pa")
prolific_df$intuition_mediators_factor <- intuition_fit$scores[,1]

# --- sample demographics --- #
# below are sample demographic stats mentioned in the appendix
table(prolific_df$gender)/nrow(prolific_df) # 45.5% male
sum(table(prolific_df$age)[1:2])/nrow(prolific_df) # 41.5% aged 18-34
sum(table(prolific_df$age)[3:5])/nrow(prolific_df) # 51.8% aged 35-64
sum(table(prolific_df$age)[6:8])/nrow(prolific_df) # 6.7% aged 65 or older
table(prolific_df$education)/nrow(prolific_df) # 56.1% have a four-year degree (or higher)

# --- regression models --- #
# main effects of power on DVs (i.e., aggressive intentions, domino beliefs, preventive strikes) 
summary(mod_intentions <- lm(aggressive_intentions ~ objective_power_trt + rei_intuition_factor + rei_deliberation_factor +  gender + age + ethnicity + ideology + education, 
                             prolific_df))
summary(mod_dominos <- lm(nuclear_dominos ~ objective_power_trt + rei_intuition_factor + rei_deliberation_factor + gender + age + ethnicity + ideology + education, 
                          prolific_df))
summary(mod_strikes <- lm(preventive_strikes ~ objective_power_trt + rei_intuition_factor + rei_deliberation_factor +  gender + age + ethnicity + ideology + education, 
                          prolific_df))
# main effects of power on mediators (i.e., the three intuition items and two sense of power items)
summary(mod_risk <- lm(risk_acceptance ~ objective_power_trt + rei_intuition_factor + rei_deliberation_factor + gender + age + ethnicity + ideology + education, 
                       prolific_df))
summary(mod_pressure <- lm(time_pressure ~ objective_power_trt + rei_intuition_factor + rei_deliberation_factor + gender + age + ethnicity + ideology + education, 
                           prolific_df))
summary(mod_confidence <- lm(threat_confidence ~ objective_power_trt + rei_intuition_factor + rei_deliberation_factor + gender + age + ethnicity + ideology + education, 
                             prolific_df))
summary(mod_control <- lm(power_control_influence ~ objective_power_trt + rei_intuition_factor + rei_deliberation_factor + gender + age + ethnicity + ideology + education, 
                          prolific_df))
summary(mod_wants <- lm(power_get_wants ~ objective_power_trt + rei_intuition_factor + rei_deliberation_factor + gender + age + ethnicity + ideology + education, 
                        prolific_df))

# --- appendix table A3
screenreg(list(mod_intentions, mod_dominos, mod_strikes))
# texreg(list(mod_intentions, mod_dominos, mod_strikes),
#        custom.coef.names = c("(Intercept)", "Symmetric Power Treatment", "High Power Treatment",
#                              "Trait Intuitive Thinking", "Trait Deliberative Thinking",
#                              "Male", "Age", "White", "Conservative", "No College Degree"),
#        custom.model.names = c("Aggressive Intentions", "Domino Beliefs", "Preventive Attacks"))

# --- appendix table A4
screenreg(list(mod_risk, mod_pressure, mod_confidence))
# texreg(list(mod_risk, mod_pressure, mod_confidence),
#        custom.coef.names = c("(Intercept)", "Symmetric Power Treatment", "High Power Treatment",
#                              "Trait Intuitive Thinking", "Trait Deliberative Thinking",
#                              "Male", "Age", "White", "Conservative", "No College Degree"),
#        custom.model.names = c("Risk Acceptance to Avoid Losses", "Perceived Urgency of Situation", "Threat Assessment Confidence"))

# --- appendix table A5
screenreg(list(mod_control, mod_wants))
# texreg(list(mod_control, mod_wants),
#        custom.coef.names = c("(Intercept)", "Symmetric Power Treatment", "High Power Treatment",
#                              "Trait Intuitive Thinking", "Trait Deliberative Thinking",
#                              "Male", "Age", "White", "Conservative", "No College Degree"),
#        custom.model.names = c("Control and Influence Over Country B", "Ability to Get What You Want"))

# --- format for plotting purposes
mod_list <- list("mod_intentions" = mod_intentions, 
                 "mod_dominos" = mod_dominos,
                 "mod_strikes" = mod_strikes,
                 "mod_risk" = mod_risk,
                 "mod_pressure" = mod_pressure,
                 "mod_confidence" = mod_confidence,
                 "mod_control" = mod_control,
                 "mod_wants" = mod_wants)
results_df <- data.frame()
for(i in 1:length(mod_list)){
  
  mod_i <- mod_list[[i]]
  
  results_df <- rbind(results_df,
                      data.frame(ci_95_high = confint(mod_i, level = .95)[,2],
                                 ci_95_low = confint(mod_i, level = .95)[,1],
                                 ci_90_high = confint(mod_i, level = .90)[,2],
                                 ci_90_low = confint(mod_i, level = .90)[,1],
                                 est = coef(mod_i),
                                 variable = names(coef(mod_i)),
                                 model = names(mod_list)[i]))
}
results_df$variable <- revalue(results_df$variable, c("objective_power_trtpower" = "High Power\nTreatment",
                                                      "objective_power_trtsymmetry" = "Symmetric Power\nTreatment",
                                                      "rei_intuition_factor" = "Trait Intuitive\nThinking",
                                                      "rei_deliberation_factor" = "Trait Deliberative\nThinking")) 
results_df$model <- factor(results_df$model, levels = c("mod_intentions", "mod_dominos", "mod_strikes", "mod_risk", "mod_pressure", "mod_confidence", "mod_control", "mod_wants"))
levels(results_df$model) <- c("Aggressive Intentions", "Domino Beliefs", "Preventive Attacks", "Risk Acceptance to Avoid Losses", "Perceived Urgency of Situation", "Threat Assessment Confidence", "Control and Influence Over Country B", "Ability to Get What You Want")
results_df <- results_df[!results_df$variable%in%c("(Intercept)", "gendermale", "age", "ethnicitywhite", "ideology", "educationless_bachelors", "Trait Deliberative\nThinking"),]
results_df$variable <- 
  factor(results_df$variable, rev(c("High Power\nTreatment", "Symmetric Power\nTreatment", "Trait Intuitive\nThinking", "Trait Deliberative\nThinking")))
results_df$plot_col <- ifelse(results_df$variable == "High Power\nTreatment",  "#99998e", "#54545d")
plot_col <- ifelse(results_df$variable == "High Power\nTreatment","#54545d",  "#99998e")

# --- figure 2 from the main text
ggplot(results_df, aes(x = est, y = variable, color = plot_col)) +
  geom_vline(xintercept = 0, linetype = "solid", color = "black", size = .8) +
  geom_linerange(aes(xmin = ci_95_low, xmax = ci_95_high), size = 1.8, color = "black") +
  geom_linerange(aes(xmin = ci_90_low, xmax = ci_90_high), size = 4) +
  geom_point(size = 6, color = "black") +
  geom_point(size = 5) +
  facet_wrap(~model, nrow = 4) +
  theme_bw() +
  #scale_x_continuous(labels = scales::percent_format(accuracy = 1)) +
  labs(x = "Estimate", y = NULL) +
  scale_color_manual(values = plot_col) + 
  theme(axis.title.x = element_text(size = 22, margin = margin(t=15)),
        axis.text.y = element_text(size = 16, color="black"),
        axis.text.x = element_text(size = 16),
        strip.text = element_text(size = 16, margin = margin(r=8,l=8,t=8,b=8)),
        legend.position = "none",
        panel.spacing = unit(1.2, "lines"),
        panel.background = element_rect(fill = "#f6f6f5"),
        strip.background = element_rect(fill = "gray90", color = "black", size = 1.5))


# --- mediation analyses --- #
# --- effect of objective power on intuitive thinking, which in turn explains DVs
# power treatment --> intuitive thinking --> aggressive intentions
set.seed(1912)
summary(med_model <- lm(intuition_mediators_factor ~ objective_power_trt + gender + age + ethnicity + ideology + education + rei_intuition_factor + rei_deliberation_factor, 
                        subset(prolific_df, objective_power_trt %in% c("weak", "power"))))
summary(dv_model <- lm(aggressive_intentions ~ objective_power_trt + intuition_mediators_factor + gender + age + ethnicity + ideology + education + rei_intuition_factor + rei_deliberation_factor, 
                       subset(prolific_df, objective_power_trt %in% c("weak", "power"))))
power_intentions_med_results <- mediation::mediate(med_model, dv_model, treat = "objective_power_trt", mediator = "intuition_mediators_factor", control.value = "weak", treat.value = "power", boot = T, sims = 2000)
summary(power_intentions_med_results)

# power treatment --> intuitive thinking --> domino beliefs
set.seed(1912)
summary(med_model <- lm(intuition_mediators_factor ~ objective_power_trt +  gender + age + ethnicity + ideology + education + rei_intuition_factor + rei_deliberation_factor, 
                        subset(prolific_df, objective_power_trt %in% c("weak", "power"))))
summary(dv_model <- lm(nuclear_dominos ~ objective_power_trt + intuition_mediators_factor + gender + age + ethnicity + ideology + education + rei_intuition_factor + rei_deliberation_factor, 
                       subset(prolific_df, objective_power_trt %in% c("weak", "power"))))
power_domino_med_results <- mediation::mediate(med_model, dv_model, treat = "objective_power_trt", mediator = "intuition_mediators_factor", control.value = "weak", treat.value = "power", boot = T, sims = 2000)
summary(power_domino_med_results)

# power treatment --> intuitive thinking --> preventive strikes
set.seed(1912)
summary(med_model <- lm(intuition_mediators_factor ~ objective_power_trt +  gender + age + ethnicity + ideology + education + rei_intuition_factor + rei_deliberation_factor, 
                        subset(prolific_df, objective_power_trt %in% c("weak", "power"))))
summary(dv_model <- lm(preventive_strikes ~ objective_power_trt + intuition_mediators_factor + gender + age + ethnicity + ideology + education + rei_intuition_factor + rei_deliberation_factor, 
                       subset(prolific_df, objective_power_trt %in% c("weak", "power"))))

power_preventive_med_results <- mediation::mediate(med_model, dv_model, treat = "objective_power_trt", mediator = "intuition_mediators_factor", control.value = "weak", treat.value = "power", boot = T, sims = 2000)
summary(power_preventive_med_results)

# --- format for appendix table
power_intentions_mediation_table <- createTexreg(coef.names = c("ACME", "ADE", "Total Effect", "Prop. Mediated"),
                                           coef = c(power_intentions_med_results$d0, power_intentions_med_results$z0, power_intentions_med_results$tau.coef, power_intentions_med_results$n0),
                                           ci.low = c(power_intentions_med_results$d0.ci[1], power_intentions_med_results$z0.ci[1], power_intentions_med_results$tau.ci[1], power_intentions_med_results$n0.ci[1]),
                                           ci.up = c(power_intentions_med_results$d0.ci[2], power_intentions_med_results$z0.ci[2], power_intentions_med_results$tau.ci[2], power_intentions_med_results$n0.ci[2]))
power_domino_mediation_table <- createTexreg(coef.names = c("ACME", "ADE", "Total Effect", "Prop. Mediated"),
                                       coef = c(power_domino_med_results$d0, power_domino_med_results$z0, power_domino_med_results$tau.coef, power_domino_med_results$n0),
                                       ci.low = c(power_domino_med_results$d0.ci[1], power_domino_med_results$z0.ci[1], power_domino_med_results$tau.ci[1], power_domino_med_results$n0.ci[1]),
                                       ci.up = c(power_domino_med_results$d0.ci[2], power_domino_med_results$z0.ci[2], power_domino_med_results$tau.ci[2], power_domino_med_results$n0.ci[2]))
power_preventive_mediation_table <- createTexreg(coef.names = c("ACME", "ADE", "Total Effect", "Prop. Mediated"),
                                           coef = c(power_preventive_med_results$d0, power_preventive_med_results$z0, power_preventive_med_results$tau.coef, power_preventive_med_results$n0),
                                           ci.low = c(power_preventive_med_results$d0.ci[1], power_preventive_med_results$z0.ci[1], power_preventive_med_results$tau.ci[1], power_preventive_med_results$n0.ci[1]),
                                           ci.up = c(power_preventive_med_results$d0.ci[2], power_preventive_med_results$z0.ci[2], power_preventive_med_results$tau.ci[2], power_preventive_med_results$n0.ci[2]))

# --- appendix table A6
screenreg(c(power_intentions_mediation_table, power_domino_mediation_table, power_preventive_mediation_table))
# texreg(c(power_intentions_mediation_table, power_domino_mediation_table, power_preventive_mediation_table),
#        custom.model.names = c("Aggressive Intentions",
#                               "Domino Beliefs",
#                               "Preventive Strikes"))

# --- effect of objective power on the sense of power, which in turn explains intuitive thinking
# power treatment --> sense of power --> intuitive thinking
set.seed(1912)
summary(med_model <- lm(sense_power_factor ~ objective_power_trt +  gender + age + ethnicity + ideology + education + rei_intuition_factor + rei_deliberation_factor, 
                        subset(prolific_df, objective_power_trt %in% c("weak", "power"))))
summary(dv_model <- lm(intuition_mediators_factor ~ objective_power_trt + sense_power_factor + gender + age + ethnicity + ideology + education + rei_intuition_factor + rei_deliberation_factor, 
                       subset(prolific_df, objective_power_trt %in% c("weak", "power"))))
power_intuition_med_results <- mediation::mediate(med_model, dv_model, treat = "objective_power_trt", mediator = "sense_power_factor", control.value = "weak", treat.value = "power", boot = T, sims = 2000, dropobs = T)
summary(power_intuition_med_results)

# --- effect of objective power on intuitive thinking, which in turn explains the sense of power
# since the mediators are measured, rather than randomized, worth checking this alternative pathway
# power treatment --> intuitive thinking --> sense of power
set.seed(1912)
summary(med_model <- lm(intuition_mediators_factor ~ objective_power_trt +  gender + age + ethnicity + ideology + education + rei_intuition_factor + rei_deliberation_factor, 
                        subset(prolific_df, objective_power_trt %in% c("weak", "power"))))
summary(dv_model <- lm(sense_power_factor ~ objective_power_trt + intuition_mediators_factor + gender + age + ethnicity + ideology + education + rei_intuition_factor + rei_deliberation_factor, 
                       subset(prolific_df, objective_power_trt %in% c("weak", "power"))))
intuition_power_med_results <- mediation::mediate(med_model, dv_model, treat = "objective_power_trt", mediator = "intuition_mediators_factor", control.value = "weak", treat.value = "power", boot = T, sims = 2000, dropobs = T)
summary(intuition_power_med_results)
# note that the proportion of power --> sense of power --> intuitive thinking is three times larger than the proportion of power --> intuitive thinking --> sense of power
# in other words, the sense of power does much more to activate intuitive thinking than intuitive thinking does to activate a sense of power, as expected

# --- format for appendix table
power_intuition_mediation_table <- createTexreg(coef.names = c("ACME", "ADE", "Total Effect", "Prop. Mediated"),
                                              coef = c(power_intuition_med_results$d0, power_intuition_med_results$z0, power_intuition_med_results$tau.coef, power_intuition_med_results$n0),
                                              ci.low = c(power_intuition_med_results$d0.ci[1], power_intuition_med_results$z0.ci[1], power_intuition_med_results$tau.ci[1], power_intuition_med_results$n0.ci[1]),
                                              ci.up = c(power_intuition_med_results$d0.ci[2], power_intuition_med_results$z0.ci[2], power_intuition_med_results$tau.ci[2], power_intuition_med_results$n0.ci[2]))
intuition_power_mediation_table <- createTexreg(coef.names = c("ACME", "ADE", "Total Effect", "Prop. Mediated"),
                                              coef = c(intuition_power_med_results$d0, intuition_power_med_results$z0, intuition_power_med_results$tau.coef, intuition_power_med_results$n0),
                                              ci.low = c(intuition_power_med_results$d0.ci[1], intuition_power_med_results$z0.ci[1], intuition_power_med_results$tau.ci[1], intuition_power_med_results$n0.ci[1]),
                                              ci.up = c(intuition_power_med_results$d0.ci[2], intuition_power_med_results$z0.ci[2], intuition_power_med_results$tau.ci[2], intuition_power_med_results$n0.ci[2]))

# --- appendix table A7
screenreg(c(power_intuition_mediation_table, intuition_power_mediation_table))
# texreg(c(power_intuition_mediation_table, intuition_power_mediation_table),
#        custom.model.names = c("Sense of Power $\\rightarrow$ Intuitive Thinking",
#                               "Intuitive Thinking $\\rightarrow$ Sense of Power"))


# --- effect of objective power on the sense of power, which in turn explains DVs
# power treatment --> sense of power --> aggressive intentions
set.seed(1912)
summary(med_model <- lm(sense_power_factor ~ objective_power_trt +  gender + age + ethnicity + ideology + education + rei_intuition_factor + rei_deliberation_factor, 
                        subset(prolific_df, objective_power_trt %in% c("weak", "power"))))
summary(dv_model <- lm(aggressive_intentions ~ objective_power_trt + sense_power_factor + gender + age + ethnicity + ideology + education + rei_intuition_factor + rei_deliberation_factor, 
                       subset(prolific_df, objective_power_trt %in% c("weak", "power"))))
intentions_med_results <- mediation::mediate(med_model, dv_model, treat = "objective_power_trt", mediator = "sense_power_factor", control.value = "weak", treat.value = "power", boot = T, sims = 2000)
summary(intentions_med_results)

# power treatment --> sense of power --> domino beliefs
set.seed(1912)
summary(med_model <- lm(sense_power_factor ~ objective_power_trt +  gender + age + ethnicity + ideology + education + rei_intuition_factor + rei_deliberation_factor, 
                        subset(prolific_df, objective_power_trt %in% c("weak", "power"))))
summary(dv_model <- lm(nuclear_dominos ~ objective_power_trt + sense_power_factor + gender + age + ethnicity + ideology + education + rei_intuition_factor + rei_deliberation_factor, 
                       subset(prolific_df, objective_power_trt %in% c("weak", "power"))))
domino_med_results <- mediation::mediate(med_model, dv_model, treat = "objective_power_trt", mediator = "sense_power_factor", control.value = "weak", treat.value = "power", boot = T, sims = 2000)
summary(domino_med_results) # note the significance of the proportion mediated narrowly misses the conventional alpha = .05 level (p = 0.051), as mentioned in the appendix

# power treatment --> sense of power --> preventive strikes
set.seed(1912)
summary(med_model <- lm(sense_power_factor ~ objective_power_trt +  gender + age + ethnicity + ideology + education + rei_intuition_factor + rei_deliberation_factor, 
                        subset(prolific_df, objective_power_trt %in% c("weak", "power"))))
summary(dv_model <- lm(preventive_strikes ~ objective_power_trt + sense_power_factor + gender + age + ethnicity + ideology + education + rei_intuition_factor + rei_deliberation_factor, 
                       subset(prolific_df, objective_power_trt %in% c("weak", "power"))))
preventive_med_results <- mediation::mediate(med_model, dv_model, treat = "objective_power_trt", mediator = "sense_power_factor", control.value = "weak", treat.value = "power", boot = T, sims = 2000)
summary(preventive_med_results)

# --- format for appendix table
intentions_mediation_table <- createTexreg(coef.names = c("ACME", "ADE", "Total Effect", "Prop. Mediated"),
                                           coef = c(intentions_med_results$d0, intentions_med_results$z0, intentions_med_results$tau.coef, intentions_med_results$n0),
                                           ci.low = c(intentions_med_results$d0.ci[1], intentions_med_results$z0.ci[1], intentions_med_results$tau.ci[1], intentions_med_results$n0.ci[1]),
                                           ci.up = c(intentions_med_results$d0.ci[2], intentions_med_results$z0.ci[2], intentions_med_results$tau.ci[2], intentions_med_results$n0.ci[2]))
domino_mediation_table <- createTexreg(coef.names = c("ACME", "ADE", "Total Effect", "Prop. Mediated"),
                                       coef = c(domino_med_results$d0, domino_med_results$z0, domino_med_results$tau.coef, domino_med_results$n0),
                                       ci.low = c(domino_med_results$d0.ci[1], domino_med_results$z0.ci[1], domino_med_results$tau.ci[1], domino_med_results$n0.ci[1]),
                                       ci.up = c(domino_med_results$d0.ci[2], domino_med_results$z0.ci[2], domino_med_results$tau.ci[2], domino_med_results$n0.ci[2]))
preventive_mediation_table <- createTexreg(coef.names = c("ACME", "ADE", "Total Effect", "Prop. Mediated"),
                                           coef = c(preventive_med_results$d0, preventive_med_results$z0, preventive_med_results$tau.coef, preventive_med_results$n0),
                                           ci.low = c(preventive_med_results$d0.ci[1], preventive_med_results$z0.ci[1], preventive_med_results$tau.ci[1], preventive_med_results$n0.ci[1]),
                                           ci.up = c(preventive_med_results$d0.ci[2], preventive_med_results$z0.ci[2], preventive_med_results$tau.ci[2], preventive_med_results$n0.ci[2]))
# --- appendix table A8
screenreg(c(intentions_mediation_table, domino_mediation_table, preventive_mediation_table))
# texreg(c(intentions_mediation_table, domino_mediation_table, preventive_mediation_table),
#        custom.model.names = c("Sense of Power $\\rightarrow$ Aggressive Intentions",
#                               "Sense of Power $\\rightarrow$ Domino Beliefs",
#                               "Sense of Power $\\rightarrow$ Preventive Strikes"))
